<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

    // day9.30
    //数组名【索引】：索引从0开始
    // let arr = [12,4,'dgf',false,null,34,,,,,124.54332];
    // console.log(arr[5]);
    // console.log(arr[6]);
    // console.log(arr);
    // console.log('---------');
    // console.log(arr.length);
    // console.log('---------');
    // for(let i = 0;i<arr.length;i++){
    //     console.log(arr[i]);
    // }

//day10.11
    //数组：一组数据
    /*
    let arr = [45,78,21,456,-78,0];
    console.log(arr[2]);  //21
    console.log(arr);  //打印对象object
    */
    //遍历数组
    /*
    for(let i = 0;i<arr.length;i++){
        console.log(arr[i]);
    }
    */
    //找出成绩score中的最高分，并求出平均数。score[45,78,89,94,63,55,80,74];
   
    let score = [45,78,89,94,63,55,80,74];
    let max=score[0],avg,sum=0;
    for(let i=0;i<score.length;i++){
        if(score[i]>max){
            max=score[i];
        }
        sum += score[i];
    }
    console.log('最高分是'+max);
    avg=sum / score.length;
    console.log('平均分是'+avg);
    console.log(score.length);
    score[47]=90;
    console.log(score.length);
    console.log(score);
    delete score[4];
    console.log(score);

</script>
</html>